﻿using System;

namespace _005_实例和静态成员
{
    public class Panda
    {
        public string Name; // 实例字段
        public static int Population; // 静态字段

        public Panda(string n) // 构造方法
        {
            Name = n; // 为实例字段赋值
            Population = Population + 1; // 增加静态字段Population的值
        }
    }
    class Program
    {
        static void Main(string[] args)
        {
            Panda p1 = new Panda("Pan Dee");
            Panda p2 = new Panda("Pan Dah");

            Console.WriteLine(p1.Name); // Pan Dee
            Console.WriteLine(p2.Name); // Pan Dah

            Console.WriteLine(Panda.Population); // 2
        }
    }
}
